package DB;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author donx
 */
public class DB {
    private static Connection con;

    public static Connection getconn(){
       try{
       Class.forName("com.mysql.jdbc.Driver");
       con=DriverManager.getConnection("jdbc:mysql://localhost:3306/bank","root","user");

       }catch(Exception e){
           System.out.println(e);
       }
       return con;
    }
public static void change(String s){
    if (con==null) {
        getconn();  
    }
    try {
        con.createStatement().executeUpdate(s);
    } catch (Exception e) {
        System.out.println(e);
    }
    
     
}

public static  ResultSet  search(String s) throws SQLException{
        if (con==null) {
            getconn();

        }
     
        return con.createStatement().executeQuery(s);

}}